﻿using System;
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.Web;

namespace NCMIS.ServiceModel.Ra
{
    public static class HttpRequest
    {
        public static string GetQueryString()
        {
            MessageProperties properties = OperationContext.Current.IncomingMessageProperties;
            HttpRequestMessageProperty requestProperty = (HttpRequestMessageProperty)properties[HttpRequestMessageProperty.Name];
            string queryString = requestProperty.QueryString;
            queryString = !String.IsNullOrEmpty(queryString) ? String.Format("{0}{1}", "?", queryString) : String.Empty;
            return queryString;
        }

        public static string RemoteHost
        {
            get
            {
                return HttpContext.Current.Request.ServerVariables["REMOTE_HOST"];
            }
        }
    }
}
